package br.com.cadele.beans;

import java.io.Serializable;
import java.util.ArrayList;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.cadele.model.Disciplina;
import br.com.cadele.service.DisciplinaService;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;
@ManagedBean(name="visualizarDisciplinaBean")
@ViewScoped
@URLBeanName(value="visualizarDisciplinaBean")
@URLMapping(id="visualizarDisciplinaBean", pattern="/disciplina/visualizar", viewId="/pages/disciplina/visualizar.xhtml")
public class VisualizarDisciplinaBean implements Serializable {


	
	Disciplina disciplina;
	private DisciplinaService disciplinaService;
	private ArrayList<Disciplina> disciplinaList;
	
    @PostConstruct
    public void init(){
       disciplinaService = new DisciplinaService();
        disciplinaList = disciplinaService.getAll();
    }
    
    public void salvar() {
			disciplinaService.executeInsert(disciplina);
    }
    
    public ArrayList<Disciplina> getDisciplinaList(){
      return disciplinaList;
    }
    
    public void setDisciplinaList(ArrayList<Disciplina> disciplinaList){
      this.disciplinaList = disciplinaList;
    }

	
	
}
